/*
 * @Description:
 * @Author: cdtangxiejun
 * @version:
 * @Date: 2024-09-10 16:12:05
 * @LastEditors: cdtangxiejun
 * @LastEditTime: 2024-09-19 09:57:41
 */
/*
 * @Descripttion:编辑器中间iframe画布区域，渲染楼层主入口
 */
import React, { useEffect, useState } from 'react'
import { BuiltInComponents } from '@modules/components'
import { DecorateContainerFloorList } from '@conecli/cone-render/modules'
import { Dialog } from '@conecli/cone-render/components'
import './index.module.scss'

document.domain = 'jd.com'
// 获取挂在父页面cone window上的 messager，通过它实现通信
const Messager = window.top._coneMessager
// 装修画布
const DecorateCanvas = (props) => {
  useEffect(() => {
    Messager?.trigger('iframeDidRender', { isFirst: true })
  }, [])
  window.top.jsonRenderMessager = null
  return (
    <>
      <DecorateContainerFloorList
        {...props}
        builtInComponents={BuiltInComponents}
      />
      <Dialog />
    </>
  )
}

export default DecorateCanvas
